package com.ctshk.sapp.order.ship.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.order.ship.dto.ShipOrderCollectionDTO;
import com.ctshk.rpc.order.ship.req.ShipOrderCollectionReq2;
import com.ctshk.rpc.order.ship.service.IShipOrderCollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import com.ctshk.common.web.support.BaseController;

import java.util.List;

/**
 * <p>
 * 船票收款明细 前端控制器
 * </p>
 *
 * @author 刘蕾
 * @since 2021-03-16
 */
@RestController
@RequestMapping("/ship-order-collection")
@Api(value = "收款记录",tags = "收款记录")
public class ShipOrderCollectionController extends BaseController {


    @DubboReference
    private IShipOrderCollectionService shipOrderCollectionService;

    @ApiOperation(value = "订单中心 - 收款记录", notes = "订单中心 - 操作订单收款记录")
    @OperationLogAnnotation(operModul = OperationLogModel.SHIP_ORDER, operType = OperationLogType.QUERY, operTitle = "订单中心 - 操作订单收款记录", operDesc = "订单中心 - 操作订单收款记录")
    @PostMapping(value = "/list")
    public Result<List<ShipOrderCollectionDTO>> list(@RequestBody ShipOrderCollectionReq2 shipOrderCollectionReq2){
        return shipOrderCollectionService.list(shipOrderCollectionReq2);
    }

    @ApiOperation(value = "船票-订单操作-再次确认收款", notes = "船票-订单操作-再次确认收款")
    @OperationLogAnnotation(operModul = OperationLogModel.SHIP_ORDER, operType = OperationLogType.UPDATE, operTitle = "船票-订单中心-再次确认收款", operDesc = "船票-订单中心-再次确认收款")
    @GetMapping("/reconfirm")
    public Result reconfirm(@RequestParam(value = "id", required = true) Long id) {
        Long userId = getCurrentUser(getRequest()).getId();
        return shipOrderCollectionService.reconfirm(id, userId);
    }
}
